import React,{useState} from 'react';
import { Select,Input, Space } from 'antd';

const { Search } = Input;
const { Option } = Select;

export default function Sel ({show}) {
    let [type,setType] = useState("time");
    let [value,setValue] = useState("");
    const onSearch = () => {
        console.log(type,value);
        show({type,value,current:1,pageSize:5});
    };
    const selectBefore = (
        <Select defaultValue={type} onChange={(e) => {
            setType(e)
        }} className="select-before">
          <Option value="time">下单时间</Option>
          <Option value="users">用户ID</Option>
        </Select>
      );
  return (
    <div>
      <Search 
        onInput={(e) => setValue(e.target.value)}
        addonBefore={selectBefore}
        enterButton="搜索"
        allowClear
        onSearch={onSearch}
        style={{ width: 304 }}
      />
    </div>
  )
}
